{case value="region"}
	{php}
        //$json_city_detail=json_decode($field['value'],true);
        $province_list = db('region')->where('level',1)->select();
    {/php}
    <div class="form-group item_{$field.name} {$field.extra_class|default=''}">
        <label for="{$field.name}" class="col-md-2 control-label">{present name="field.confirm"}{eq name="field.confirm" value="required"}<sup>*</sup>{/eq}{/present}{$field.title}</label>
        <div class="col-md-6">
            <div class="region_fields">

                <select name="province" id="region_field_province">
                    <option value="">请选择省份</option>
                    {foreach $province_list as $row}
                        <option value="{$row.region_id}" {present name="field.options.province"}{eq name="field.options.province" value="$row.region_id" }selected{/eq}{/present}>{$row.region_name}</option>
                    {/foreach}
                </select>
                <select name="city" id="region_field_city">
                    <option value="">请选择城市</option>
                    {notempty name="field.options"}
                        {php}$city_list=db('region')->where('parent_id',$field['options']['province'])->select();{/php}
                        {foreach $city_list as $row}
                            <option value="{$row.region_id}" {eq name="field.options.city" value="$row.region_id" }selected{/eq}>{$row.region_name}</option>
                        {/foreach}
                    {/notempty}
                </select>
                <select name="area" id="region_field_area">
                    <option value="">请选择地区</option>
                    {notempty name="field.options"}
                        {php}$area_list=db('region')->where('parent_id',$field['options']['city'])->select();{/php}
                        {foreach $area_list as $row}
                            <option value="{$row.region_id}" {eq name="field.options.area" value="$row.region_id" }selected{/eq}>{$row.region_name}</option>
                        {/foreach}
                    {/notempty}
                </select>
            </div>
        
	        {notempty name="field.description"}<p class="help-block"><i class="fa fa-info-circle color-info1"></i> {$field.description}</p>{/notempty}
        </div>
        <script type="text/javascript">
        $(function(){
            //选择省份
            $('#region_field_province').change(function(){
                $.get("{:url('api/main/getRegionSelect')}", {pid:$(this).val()}, function (data) {

                    $("#region_field_city").html(data);
                    $("#region_field_area").html('').hide();
                })
            });
            //选择城市
            $('#region_field_city').change(function(){
                $.get("{:url('api/main/getRegionSelect')}", {pid:$(this).val()}, function (data) {

                    $("#region_field_area").html(data).show();
                })
            });
        });

        </script>
    </div>

{/case}